package ml;

public class Ticket {
	public boolean m_is_buy;
	public double m_volume;
	public double m_open_price;
	public double m_stop_loss;
	public double m_take_profit;
	public boolean m_is_closed;

	public Ticket(boolean is_buy, double volume, double open_price, double stop_loss,
					double take_profit) {
		m_is_buy = is_buy;
		m_volume = volume;
		m_open_price = open_price;
		m_stop_loss = stop_loss;
		m_take_profit = take_profit;
		m_is_closed = false;
	}

	public void Update(double stop_loss, double take_profit) {
		m_stop_loss = stop_loss;
		m_take_profit = take_profit;
	}

	public double Profit(double price) {
		double profit = 0.0;
		if (m_is_buy) {
			profit = (price - m_open_price);
		} else {
			profit = (m_open_price - price);
		}

		return profit;
	}
}
